import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HouseCostVO, HouseCostForm, HouseCostQuery } from '@/api/business/houseCost/types';

/**
 * 查询房屋费用列表
 * @param query
 * @returns {*}
 */

export const listHouseCost = (query?: HouseCostQuery): AxiosPromise<HouseCostVO[]> => {
  return request({
    url: '/business/houseCost/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询房屋费用详细
 * @param houseCostId
 */
export const getHouseCost = (houseCostId: string | number): AxiosPromise<HouseCostVO> => {
  return request({
    url: '/business/houseCost/' + houseCostId,
    method: 'get'
  });
};

/**
 * 新增房屋费用
 * @param data
 */
export const addHouseCost = (data: HouseCostForm) => {
  return request({
    url: '/business/houseCost',
    method: 'post',
    data: data
  });
};

/**
 * 修改房屋费用
 * @param data
 */
export const updateHouseCost = (data: HouseCostForm) => {
  return request({
    url: '/business/houseCost',
    method: 'put',
    data: data
  });
};

/**
 * 删除房屋费用
 * @param houseCostId
 */
export const delHouseCost = (houseCostId: string | number | Array<string | number>) => {
  return request({
    url: '/business/houseCost/' + houseCostId,
    method: 'delete'
  });
};
